<template>
	<view>
		<view class="top">
			<u-search shape="round" :showAction="false" v-model="keyword" placeholderColor="请输入内容" focus @search="search(keyword)"
				style="width: 645rpx; height: 68rpx; float: right; margin: 10rpx 50rpx; opacity: 50%;"></u-search>
		</view>
	</view>
</template>

<script>
	import {
		cpss
	} from '@/api/api.js'
	export default {
		data() {
			return {
				keyword: '25',
				page: 1,

			}
		},
		onLoad(options) {
			//分享微信好友
			if (this.$wechat && this.$wechat.isWechat()) {
				this.$wechat.share();
			}
			console.log(options)
			this.keyword = options.keyword
			this.c_pss()
		},
		methods: {
			tz() {
				uni.navigateTo({
					url: 'sousuo_lb'
				})
			},

			c_pss: function() {
				cpss({
					keyword: this.keyword,
					page: this.page
				}).then(res => {
					console.log(res)
					this.ss = res.data;
				})
			},

			search(keyword) {
				if(!keyword){
					uni.showToast({
						title:'搜索关键字不能为空！',
						icon:'none'
					})
					return
				}
				uni.navigateTo({
					url: './sousuo_lb?keyword=' + keyword
				})
			}
		}
	}
</script>

<style>
	.top {
		width: 100%;
		height: 88rpx;
		background: linear-gradient(to right, #94B0FF, #4575FC);
	}
</style>
